package com.zr.dao.impl;

import java.util.List;


import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.ProxyDao;
import com.zr.model.Point_psfw_vo;

@Repository("proxydao")
public class ProxyDaoImpl<T> extends BaseDaOImpl<T> implements ProxyDao<T>{
	
	@Override
	public List<Point_psfw_vo> findAllproxy(int page, int rows) {
		String sql = "SELECT psfwb.did,psfwb.dname,psfwb.uid,point.pname FROM point,psfwb WHERE point.pid=psfwb.pid";
    	Query query = this.getCurrentSession().createSQLQuery(sql);
    	query.setFirstResult((page-1)*rows);// 起始位置
    	query.setMaxResults(rows);//记录数
    	List<Point_psfw_vo> ts = query.list();
		return ts;
	}

	@Override
	public long countAllproxy() {
		String hql = "select count(*) from Psfwb";
		List<Object>  obj = this.getCurrentSession().createQuery(hql).list();
		return (long)obj.get(0);
	}
	
}
